import {Entity, PrimaryGeneratedColumn, Column} from "typeorm"
@Entity("sys_user")
export class User{
  @PrimaryGeneratedColumn()
  id: number

  @Column({
    type:'varchar',
    nullable: false,
    length:30,
    name:'user_name',
    comment:'用户账号'
  })
  userName:string

  @Column({
    type:'varchar',
    length:50,
    name:'email',
    comment:'用户邮箱',
    default:''
  })
  email:string

  @Column({
    type:'varchar',
    length:11,
    name:'phonenumber',
    comment:'手机号码',
    default:''
  })
  phonenumber:string

  @Column({
    type:'int',
    nullable: false,
    name:'sex',
    comment:'用户性别（0男 1女 2未知）',
    default: 0,
  })
  sex:number

  @Column({
    type:'varchar',
    length:100,
    name:'avatar',
    comment:'头像地址',
    default:''
  })
  avatar:string


  @Column({
    type: 'varchar',
    nullable: true,
    length: 128,
    name: 'password',
    comment: '密码',
  })
  password: string


  @Column({
    type: 'timestamp',
    nullable: false,
    name: 'create_time',
    comment: '创建时间',
    default: () => 'CURRENT_TIMESTAMP', // 设置默认值为当前时间戳
  })
  createTime: Date;

}
